﻿

CREATE function Format_Int(@Num varchar(128))
RETURNS varchar(25) AS
BEGIN
declare @I int

SET @Num = CONVERT(bigint,CONVERT(numeric(36,2),@Num))
SET @I = LEN(@Num)-2

WHILE @I > 1
	SELECT @Num = STUFF(@Num,@I,0,','),@I = @I-3

RETURN @Num
END


